<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="centre/manage/include :: header"></head>
<link href="/css/bootstrap-star-rating/star-rating.css" media="all" rel="stylesheet" type="text/css"/>

<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="commentUpdateForm">
							<div class="form-group">
								<label class="col-sm-2 control-label">选择商品:</label>
								<div class="col-sm-6">
									<input type="hidden" name="id" th:value="${obj.id}">
									<input type="hidden" name="productId" id="productId" th:value="${obj.productId}">
									<input id="title" name="title" placeholder="选择商品"
										class="form-control" type="text" readonly th:value="${obj.productName}">
								</div>
								<div class="col-sm-2">
									<button type="button" class="btn btn-primary" onclick="toSelectProduct()">
									<i class="fa fa-check"></i>选择商品</button>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">评论人昵称:</label>
								<div class="col-sm-8">
									<input id="nickname" name="nickname" class="form-control"
										type="text" th:value="${obj.nickname}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">评论人头像:</label>
								<div class="col-sm-6">
									<div class="input-group">
							    	<input type="text" class="form-control" readonly="readonly" 
							    		th:value="${obj.headimgurl}" id="thumb" name="headimgurl">
							    	<span class="input-group-btn">
							    		<button type="button" class="btn btn-primary" onclick="onSelectImgBtnClick('thumb','thumbImg')">
							    			<i class="fa fa-check"></i>选择图片
							    		</button>
							    	</span>
							    	</div>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8">
									<label class="col-sm-5 control-label"></label> 
									<img id="thumbImg" th:src="@{obj.headimgurl}" style="max-width: 30%">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">评分等级:</label>
								<div class="col-sm-6">
									<input th:value="${obj.level}" type="text" class="rating" 
										data-min=0 data-max=5 data-step=1 data-size="lg"
               							title="" id="level" name="level">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"> * 首次评价：  </label>
								<div class="col-sm-10">
									<textarea class="col-xs-10 col-sm-6" style="height:90px;"
										name='content' th:text="${obj.content}"></textarea>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"></label>
								<div class="col-sm-6">
       								<div class="input-group">
    									<input type="text" class="form-control" readonly="readonly" 
    										th:value="${obj.images}" placeholder="批量上传图片" id="images" name="images">
    									<span class="input-group-btn">
								    		<button class="btn btn-primary" type="button" 
								    			onclick="selectImgs('images')">
								    			<i class="fa fa-check"></i>选择图片
								    		</button>
								    		<input type="hidden" value="images" />
								    	</span>
								    </div>
								    <div class="input-group multi-img-details"></div>	
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"> 首次回复：  </label>
								<div class="col-sm-10">
									<textarea class="col-xs-10 col-sm-6" style="height:90px;"
										name='replyContent' th:text="${obj.replyContent}"></textarea>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"></label>
								<div class="col-sm-6">
			    					<div class="input-group">
    									<input type="text" class="form-control" readonly="readonly" 
    										th:value="${obj.replyImages}" placeholder="批量上传图片" id="replyImages" name="replyImages">
								    	<span class="input-group-btn">
								    		<button class="btn btn-primary" type="button" 
								    			onclick="selectImgs('replyImages')">
								    			<i class="fa fa-check"></i>选择图片
								    		</button>
								    		<input type="hidden" value="reply_images" />
								    	</span>
    								</div>
    								<div class="input-group multi-img-details"></div>	
    							</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"> 追加评价：  </label>
								<div class="col-sm-10">
									<textarea class="col-xs-10 col-sm-6" style="height:90px;" 
										name='appendContent' th:text="${obj.appendContent}"></textarea>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"></label>
								<div class="col-sm-6">
			    					<div class="input-group">
								    	<input type="text" class="form-control" readonly="readonly" 
								    		th:value="${obj.appendImages}" placeholder="批量上传图片" name="appendImages" id="appendImages">
								    	<span class="input-group-btn">
								    		<button class="btn btn-primary" type="button" 
								    			onclick="selectImgs('appendImages')">
								    			<i class="fa fa-check"></i>选择图片
								    		</button>
								    		<input type="hidden" value="append_images" />
								    	</span>
								    </div>
								    <div class="input-group multi-img-details"></div>	
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"> 追加回复： </label>
								<div class="col-sm-10">
									<textarea class="col-xs-10 col-sm-6" style="height:90px;"
										name='appendReplyContent' th:text="${obj.appendReplyContent}"></textarea>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-2 control-label no-padding-right"></label>
								<div class="col-sm-6">
			    					<div class="input-group">
								    	<input type="text" class="form-control" readonly="readonly" 
								    		th:value="${obj.appendReplyImages}" placeholder="批量上传图片" id="appendReplyImages" name="appendReplyImages">
								    	<span class="input-group-btn">
								    		<button class="btn btn-primary" type="button" 
								    			onclick="selectImgs('appendReplyImages')">
								    			<i class="fa fa-check"></i>选择图片
								    		</button>
								    		<input type="hidden" value="append_images" />
								    	</span>
								    </div>
								    <div class="input-group multi-img-details"></div>	
								</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="submit" class="btn btn-primary" onclick="update()">
										<i class="fa fa-check"></i>提交
									</button>
									<div class="btn btn-danger" onclick="closeDow()">
										<i class="fa fa-remove"></i> 关闭
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

	</div>
	<!-- 选择商品html部分 start -->
	<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">选择商品</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<div class="form-horizontal form-search">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										style="padding-top:2px;">商品搜索： 
									</label>
									<div class="col-sm-9">
										<input type="text" name="mgkey" id="mgkey"
											placeholder="输入商品ID以及名称搜索"
											class="col-xs-10 col-sm-7"> 
										<span class="input-group-btn">
											<button onclick="get_goods()" type="button"
												class="btn btn-xs btn-primary">搜索
											</button>
										</span>
									</div>
								</div>
								<div class="space-4"></div>
							</div>
						</div>
					</div>

					<div class="row">
						<div class="col-xs-12">
							<div>
								<input name="p" id="p" value="1" type="hidden">
								<div class="table-responsive">
									<table class="table table-striped table-bordered table-hover"
										id="dynamic-table">
										<thead>
											<tr>
												<th class="hidden-xs" style="text-align: center">ID</th>
												<th>商品图片</th>
												<th>商品名称</th>
												<th style="border-right: #CCC solid 1px;">操作</th>
											</tr>
										</thead>
										<tbody id="ajax-data">
											<tr>
												<td class="hidden-xs" colspan="5" align="center">请搜索要选择的商品</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 选择商品html部分 end -->
	<div th:include="centre/manage/include::footer"></div>
	<script type="text/javascript" src="/js/appjs/product/comment/edit.js"></script>
	<script type="text/javascript" src="/js/bootstrap-star-rating/star-rating.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}
	</script>
</body>
</html>
